package o;

import android.content.Intent;
import com.huawei.appgallery.appcomment.impl.bean.AddCommentResBean;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import java.lang.ref.WeakReference;
import o.bcg.h;

public class bdk implements IServerCallBack {
    private WeakReference<beh> ॱ;

    public bdk(beh o_beh) {
        this.ॱ = new WeakReference(o_beh);
    }

    public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
    }

    public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
        if (responseBean != null) {
            int i;
            if (responseBean.getResponseCode() == 3) {
                i = h.ᐝʽ;
            } else if (responseBean.getResponseCode() == 0 && (responseBean instanceof AddCommentResBean)) {
                i = ˏ((AddCommentResBean) responseBean, (bcr) o_cvu);
            } else {
                i = h.ॱﾟ;
            }
            if (i != -1) {
                ckv.ˎ(ContentManager.getInstant().getContext().getResources().getString(i), 0);
            }
            beh o_beh = (beh) this.ॱ.get();
            if (o_beh != null && responseBean.getRtnCode_() == 0 && !o_beh.ʽ()) {
                o_beh.ॱ();
                o_beh.ˎ(true);
            }
        }
    }

    private int ˏ(AddCommentResBean addCommentResBean, bcr o_bcr) {
        int i = -1;
        if (addCommentResBean.getRtnCode_() == 0) {
            Intent intent = new Intent("com.huawei.appmarket.service.broadcast.CommentAdded");
            intent.putExtra("ACTION_PARAM_COMMENT_ADDED_TYPE_APPID", o_bcr.ˊ());
            intent.putExtra("ACTION_PARAM_COMMENT_REPLY_ADDED_TYPE_COMMENTID", addCommentResBean.commentId_);
            intent.putExtra("ACTION_PARAM_COMMENT_ADDED_TYPE_RATING", o_bcr.ˎ());
            intent.putExtra("ACTION_PARAM_COMMENT_ADDED_TYPE_CONTENT", o_bcr.ˏ());
            ll.ˏ(ContentManager.getInstant().getContext()).ˋ(intent);
            bcb.ˋ.ˋ("AddThirdCommentCallBack", "notifyResult, ACTION_COMMENT_ADDED, lastCommentID:" + addCommentResBean.commentId_);
        } else if (addCommentResBean.getRtnCode_() == 1) {
            i = h.ʿॱ;
        } else if (addCommentResBean.getRtnCode_() == 4) {
            bdr.ˋ();
            i = h.ˉॱ;
        } else {
            i = h.ˉॱ;
        }
        bcb.ˋ.ˋ("AddThirdCommentCallBack", "getCommentResId RtnCode:" + addCommentResBean.getRtnCode_());
        return i;
    }
}
